package mil.af.amc.adpetracker.web.actions.struts2.organization;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;
import mil.af.amc.adpetracker.model.Organization;
import mil.af.amc.adpetracker.service.OrganizationService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author Jason Ferguson
 */
public class OrganizationAction extends ActionSupport implements ModelDriven<Organization>, Preparable {

    @Autowired
    private OrganizationService organizationService;

    // ModelDriven implementation
    private Organization model;

    public Organization getModel() {
        return model;
    }

    // Preparable implementation
    public void prepare() {

    }

    public void prepareExecute() {

    }

    private List<Organization> organizationList;

    public String execute() {
        organizationList = organizationService.getAll();

        return SUCCESS;
    }

    public String viewCreate() {
        throw new UnsupportedOperationException();
    }

    public String create() {
        throw new UnsupportedOperationException();
    }
}
